package top.kaoshanji.p3ch04a;

import org.apache.ibatis.session.SqlSession;
import org.junit.Test;
import top.kaoshanji.p3ch04a.mapper.CustomerMapper;
import top.kaoshanji.p3ch04a.model.Customer;
import top.kaoshanji.p3ch04a.util.SqlSessionUtil;

/**
 * @author kaoshanji
 * ^_^
 * create time 2025/4/19 17:33
 */
public class CustomerMapperTest {

    /**
     * 代码清单test-p3ch04a-82页a：依据id查询customer方式3
     */
    @Test
    public void testQueryCustomerById3() {
        SqlSession sqlSession = null;
        try {
            sqlSession = SqlSessionUtil.getSqlSession();
            CustomerMapper customerMapper = sqlSession.getMapper(CustomerMapper.class);

            Customer customer = customerMapper.queryCustomerById3(1);
            System.out.println(customer);

        } finally {
            SqlSessionUtil.closeSqlSession(sqlSession);
        }
    }

}
